Rename the SCSS files for our themes
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 12 Feb 2020 20:18:27 +0000 (20:18 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 12 Feb 2020 20:22:43 +0000 (20:22 +0000)
It seems that Meson's gnome.compile_resources() cannot deal with two
files with the same name under different directories, which breaks the
build parallelism because the GResource file ends up not depending on
either the Adwaita or the HighContrast gtk-contained.css file.

This commit only changes the on-disk names of the Adwaita and
HighContrast SCSS files, and the corresponding generated CSS files; the
files in the GResource are going to be aliased to the old file names, to
minimise the breakage. We might want to change the theme entry points at
some later date, if we decide to commit to this naming scheme.

Fixes: #2423
See Meson bug: https://github.com/mesonbuild/meson/issues/6615

12 files changed:
gtk/gen-gtk-gresources-xml.py
gtk/meson.build
gtk/theme/Adwaita/Adwaita-dark.scss [new file with mode: 0644]
gtk/theme/Adwaita/Adwaita.scss [new file with mode: 0644]
gtk/theme/Adwaita/gtk-contained-dark.scss [deleted file]
gtk/theme/Adwaita/gtk-contained.scss [deleted file]
gtk/theme/Adwaita/meson.build
gtk/theme/HighContrast/HighContrast-inverse.scss [new file with mode: 0644]
gtk/theme/HighContrast/HighContrast.scss [new file with mode: 0644]
gtk/theme/HighContrast/gtk-contained-inverse.scss [deleted file]
gtk/theme/HighContrast/gtk-contained.scss [deleted file]
gtk/theme/HighContrast/meson.build

index 95bccf92685356df38cec1be3a851a5948a079e9..9f3ea374ef92b4f4649f70b567011f00b4ddb125 100644 (file)
@@ -20,8 +20,8 @@ xml += '''
     <file>theme/Empty/gtk.css</file>
     <file>theme/Adwaita/gtk.css</file>
     <file>theme/Adwaita/gtk-dark.css</file>
-    <file>theme/Adwaita/gtk-contained.css</file>
-    <file>theme/Adwaita/gtk-contained-dark.css</file>
+    <file alias='theme/Adwaita/gtk-contained.css'>theme/Adwaita/Adwaita.css</file>
+    <file alias='theme/Adwaita/gtk-contained-dark.css'>theme/Adwaita/Adwaita-dark.css</file>
 '''
 
 for f in get_files('theme/Adwaita/assets', '.png'):
@@ -35,8 +35,8 @@ for f in get_files('theme/Adwaita/assets', '.svg'):
 xml += '''
     <file>theme/HighContrast/gtk.css</file>
     <file alias='theme/HighContrastInverse/gtk.css'>theme/HighContrast/gtk-inverse.css</file>
-    <file>theme/HighContrast/gtk-contained.css</file>
-    <file>theme/HighContrast/gtk-contained-inverse.css</file>
+    <file alias='theme/HighContrast/gtk-contained.css'>theme/HighContrast/HighContrast.css</file>
+    <file alias='theme/HighContrast/gtk-contained-inverse.css'>theme/HighContrast/HighContrast-inverse.css</file>
 '''
 
 for f in get_files('theme/HighContrast/assets', '.png'):
index 295ed0af6d16f6f984cce5dac488453c3f855925..4d2bed0ccf1fa08101ebc2265b47f16ff2f06dc5 100644 (file)
@@ -751,7 +751,6 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
                                     ])
 
 # Build the theme files
-theme_deps = []
 sassc = find_program('sassc', required: false)
 if not sassc.found()
   subproject('sassc')
@@ -763,16 +762,22 @@ sassc_opts = [ '-a', '-M', '-t', 'compact' ]
 subdir('theme/Adwaita')
 subdir('theme/HighContrast')
 
+theme_deps = [
+  adwaita_theme_deps,
+  hc_theme_deps,
+]
+
 gtkresources = gnome.compile_resources('gtkresources',
-                                       gtk_gresources_xml,
-                                       dependencies: theme_deps,
-                                       source_dir: [
-                                         # List in order of preference
-                                         meson.current_build_dir(),
-                                         meson.current_source_dir(),
-                                       ],
-                                       c_name: '_gtk',
-                                       extra_args: '--manual-register')
+  gtk_gresources_xml,
+  dependencies: theme_deps,
+  source_dir: [
+    # List in order of preference
+    meson.current_build_dir(),
+    meson.current_source_dir(),
+  ],
+  c_name: '_gtk',
+  extra_args: '--manual-register',
+)
 
 gtk_x11_sources = files([
   'gtkapplication-x11.c',
diff --git a/gtk/theme/Adwaita/Adwaita-dark.scss b/gtk/theme/Adwaita/Adwaita-dark.scss
new file mode 100644 (file)
index 0000000..6e57539
--- /dev/null
@@ -0,0 +1,6 @@
+$variant: 'dark';
+
+@import 'colors';
+@import 'drawing';
+@import 'common';
+@import 'colors-public';
diff --git a/gtk/theme/Adwaita/Adwaita.scss b/gtk/theme/Adwaita/Adwaita.scss
new file mode 100644 (file)
index 0000000..ee5e202
--- /dev/null
@@ -0,0 +1,12 @@
+// General guidelines:
+// - very unlikely you want to edit something else than _common.scss
+// - keep the number of defined colors to a minimum, use the color blending functions if
+//   you need a subtle shade
+// - if you need to inverse a color function use the @if directive to match for dark $variant
+
+$variant: 'light';
+
+@import 'colors';
+@import 'drawing';
+@import 'common';
+@import 'colors-public';
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.scss b/gtk/theme/Adwaita/gtk-contained-dark.scss
deleted file mode 100644 (file)
index 6e57539..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-$variant: 'dark';
-
-@import 'colors';
-@import 'drawing';
-@import 'common';
-@import 'colors-public';
diff --git a/gtk/theme/Adwaita/gtk-contained.scss b/gtk/theme/Adwaita/gtk-contained.scss
deleted file mode 100644 (file)
index ee5e202..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// General guidelines:
-// - very unlikely you want to edit something else than _common.scss
-// - keep the number of defined colors to a minimum, use the color blending functions if
-//   you need a subtle shade
-// - if you need to inverse a color function use the @if directive to match for dark $variant
-
-$variant: 'light';
-
-@import 'colors';
-@import 'drawing';
-@import 'common';
-@import 'colors-public';
index 7a799f947dee114ca7d85f3ae8fb4e93c61ed7c8..c829c9126acb2f5c90e4ab16756876531f3764bc 100644 (file)
@@ -1,30 +1,32 @@
-scss_files = files([
+adwaita_scss_files = files([
   '_colors-public.scss',
   '_colors.scss',
   '_common.scss',
   '_drawing.scss',
 ])
 
-theme_variants = [
+adwaita_theme_variants = [
   'dark',
 ]
 
-theme_deps += custom_target('Adwaita',
-                            input: 'gtk-contained.scss',
-                            output: 'gtk-contained.css',
-                            command: [
-                              sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                            ],
-                            depend_files: scss_files,
-                            build_by_default: true)
+adwaita_theme_deps = [
+  custom_target('Adwaita theme',
+    input: 'Adwaita.scss',
+    output: 'Adwaita.css',
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: adwaita_scss_files,
+  ),
+]
 
-foreach variant: theme_variants
-  theme_deps += custom_target('Adwaita-' + variant,
-                              input: 'gtk-contained-@0@.scss'.format(variant),
-                              output: 'gtk-contained-@0@.css'.format(variant),
-                              command: [
-                                sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                              ],
-                              depend_files: scss_files,
-                              build_by_default: true)
+foreach variant: adwaita_theme_variants
+  adwaita_theme_deps += custom_target('Adwaita theme variant: ' + variant,
+    input: 'Adwaita-@0@.scss'.format(variant),
+    output: 'Adwaita-@0@.css'.format(variant),
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: adwaita_scss_files,
+  )
 endforeach
diff --git a/gtk/theme/HighContrast/HighContrast-inverse.scss b/gtk/theme/HighContrast/HighContrast-inverse.scss
new file mode 100644 (file)
index 0000000..6cc8033
--- /dev/null
@@ -0,0 +1,11 @@
+// General guidelines:
+// - very unlikely you want to edit something else than _common.scss
+// - keep the number of defined colors to a minimum, use the color blending functions if
+//   you need a subtle shade
+// - if you need to inverse a color function use the @if directive to match for dark $variant
+
+$variant: 'dark';
+
+@import 'colors';
+@import 'drawing';
+@import 'common';
diff --git a/gtk/theme/HighContrast/HighContrast.scss b/gtk/theme/HighContrast/HighContrast.scss
new file mode 100644 (file)
index 0000000..84fbdc5
--- /dev/null
@@ -0,0 +1,11 @@
+// General guidelines:
+// - very unlikely you want to edit something else than _common.scss
+// - keep the number of defined colors to a minimum, use the color blending functions if
+//   you need a subtle shade
+// - if you need to inverse a color function use the @if directive to match for dark $variant
+
+$variant: 'light';
+
+@import 'colors';
+@import 'drawing';
+@import 'common';
diff --git a/gtk/theme/HighContrast/gtk-contained-inverse.scss b/gtk/theme/HighContrast/gtk-contained-inverse.scss
deleted file mode 100644 (file)
index 6cc8033..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// General guidelines:
-// - very unlikely you want to edit something else than _common.scss
-// - keep the number of defined colors to a minimum, use the color blending functions if
-//   you need a subtle shade
-// - if you need to inverse a color function use the @if directive to match for dark $variant
-
-$variant: 'dark';
-
-@import 'colors';
-@import 'drawing';
-@import 'common';
diff --git a/gtk/theme/HighContrast/gtk-contained.scss b/gtk/theme/HighContrast/gtk-contained.scss
deleted file mode 100644 (file)
index 84fbdc5..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// General guidelines:
-// - very unlikely you want to edit something else than _common.scss
-// - keep the number of defined colors to a minimum, use the color blending functions if
-//   you need a subtle shade
-// - if you need to inverse a color function use the @if directive to match for dark $variant
-
-$variant: 'light';
-
-@import 'colors';
-@import 'drawing';
-@import 'common';
index f3230353efdc35934e4f266c1530c501eb46a78a..da81db45c5652368e5a1bfec1f265f098b85cfee 100644 (file)
@@ -1,29 +1,31 @@
-scss_files = files([
+hc_scss_files = files([
   '_colors.scss',
   '_common.scss',
   '_drawing.scss',
 ])
 
-theme_variants = [
+hc_theme_variants = [
   'inverse',
 ]
 
-theme_deps += custom_target('HighContrast',
-                            input: 'gtk-contained.scss',
-                            output: 'gtk-contained.css',
-                            command: [
-                              sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                            ],
-                            depend_files: scss_files,
-                            build_by_default: true)
+hc_theme_deps = [
+  custom_target('HighContrast theme',
+    input: 'HighContrast.scss',
+    output: 'HighContrast.css',
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: hc_scss_files,
+  )
+]
 
-foreach variant: theme_variants
-  theme_deps += custom_target('HighContrast-' + variant,
-                              input: 'gtk-contained-@0@.scss'.format(variant),
-                              output: 'gtk-contained-@0@.css'.format(variant),
-                              command: [
-                                sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
-                              ],
-                              depend_files: scss_files,
-                              build_by_default: true)
+foreach variant: hc_theme_variants
+  hc_theme_deps += custom_target('HighContrast theme variant: ' + variant,
+    input: 'HighContrast-@0@.scss'.format(variant),
+    output: 'HighContrast-@0@.css'.format(variant),
+    command: [
+      sassc, sassc_opts, '@INPUT@', '@OUTPUT@',
+    ],
+    depend_files: hc_scss_files,
+  )
 endforeach